<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>广告管理 - 新增广告</title>
<link href="/style/css/summernote.css" rel="stylesheet">

<?php include $this->c['_homes']['_viewsHome'] . '/_global/_head.php';?>
<style type="text/css">
  .adv_edit{padding: 5px;border:1px solid#ebebeb;overflow: hidden;margin: 5px 5px 10px;width: 70%;display: flex;align-items: flex-start;}
  .adv_left{font-size: 16px;color: #333;width: 17%;float: left;text-align: right;}
  .adv_right{width: 82%;width: 83%;float: left;margin-left: 2%;}
  .adv_red{ color: red;font-size: 12px; }

</style>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">

<!-- BEGIN HEADER -->
<?php include $this->c['_homes']['_viewsHome'] . '/_global/head.php';?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" >
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include $this->c['_homes']['_viewsHome'] . '/_global/menu.php';?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR -->
  <!-- BEGIN PAGE -->
  <div class="page-content">
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 新增广告 </h3>
        <ul class="page-breadcrumb breadcrumb">
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 广告管理 <i class="icon-angle-right"></i> </li>
          <li> <a href="/adv/advlist">广告列表</a> <i class="icon-angle-right"></i> </li>
          <li>新增广告</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
      </div>
    </div>
    <!-- END PAGE HEADER-->
    <!-- BEGIN PAGE CONTENT-->

    <div class="row">
      <div class="col-md-12">
        <!-- BEGIN SAMPLE FORM PORTLET-->
        <form class="form-horizontal" method="post" action="/adv/savearticle" id="add" onSubmit="return chkfrm();" role="form" enctype="multipart/form-data">
          <input type="hidden" name="act" value="add">
          <div class="tabbable tabbable-custom boxless">
            <ul class="nav nav-tabs">
              <li class="active"><a href="#tab_0" data-toggle="tab">广告信息</a></li>
            </ul>
            <div class="tab-content">
              <!--Tab0-->
              <div class="tab-pane active" id="tab_0">
                <div class="portlet box blue ">
                  <div class="portlet-title">
                    <div class="caption"> <i class="icon-reorder"></i> 广告基本资料 </div>
                  </div>
                  <div class="portlet-body form">
                    <div class="form-body">

                      <div class="form-group">
                        <label  class="col-md-2 control-label">广告标题<span class="required">*</span></label>
                        <div class="col-md-6">
                          <input type="text" name="title" id="title" maxlength="40" class="form-control"  placeholder="请输入广告标题">
                          <span class="help-block">40汉字以内</span> </div>
                      </div>

                      <div class="form-group">
                        <label  class="col-md-2 control-label">广告内容<span class="required">*</span></label>
                        <div class="col-md-6">
                          <textarea name="content" id="content" maxlength="200" class="form-control"  placeholder="请输入广告内容"></textarea>
                          <span class="help-block">200个汉字以内</span>
                          </div>
                      </div>

                      <div class="form-group">
                            <label  class="col-md-2 control-label">封面图</label>
                            <div class="col-md-6">
                                <input id="head_image" class="uploader_input" type="file" name="pic">
                            <p class="help-block">只允许上传JPG图片，2M以内</p>
                            </div>
                      </div>

                      <div class="form-group">
                        <label class="col-md-2 control-label">广告位</label>
                        <div class="col-md-6">
                          <select class="form-control" name="position">
                             <option value="">选择广告位</option>
                            <?php
                            if($this->c['position'])
                            {
                              foreach($this->c['position'] as $id =>$name)
                              {
                                echo '<option value="'.$id.'">'.$name.'</option>';
                              }
                            } 
                            ?>  
                          </select>
                          </div>
                      </div> 

                      <div class="form-group">
                        <label  class="col-md-2 control-label">排序</label>
                        <div class="col-md-6">
                          <input type="text" name="sorts" id="sorts"  value="0" class="form-control"  placeholder="请输入排序">
                          </div>
                      </div>

                      <div class="adv_edit"><div class="adv_left">注:</div>  <div class="adv_right"><p class="adv_red">以下三个设置选择一个进行设置，不可同时设置。</p> </div>  </div> 


                    <div class="adv_edit">
                      <div class="adv_left">消息类:</div>  
                      <div class="adv_right">
                        <p class="adv_red">若需要同一广告设置不同跳转内容，可分别在在下方填写不同的链接地址。</p>
                        <p class="adv_red">设置内容相同时，设置相同值即可</p>
                        <p class="adv_red">后台发布的内容输入 /article/show?id=（文章ID）。外部链接直接输入地址(例如：https://www.baidu.com/)。</p>
                        <div class="form-group">
                          <label  class="col-md-2 control-label">微信广告url<span class="required"></span></label>
                        <div class="col-md-6">
                          <input type="text" name="wechat_url" maxlength="100" class="form-control"  placeholder="请输入广告url">
                          <!-- <span class="help-block">【内部消息输入 /article/show?id=(文章ID)】【外部链接直接输入地址】</span>  -->
                        </div>
                        </div>
                        <div class="form-group">
                          <label  class="col-md-2 control-label">APP广告url<span class="required"></span></label>
                          <div class="col-md-6">
                            <input type="text" name="app_url" maxlength="100" class="form-control"  placeholder="请输入广告url">
                            <!-- <span class="help-block">【内部消息输入 /article/show?id=(文章ID)】【外部链接直接输入地址】</span> --> </div>
                          </div>
                      </div>
                    </div>
                      
                    <div class="adv_edit">
                        <div class="adv_left">商品类:</div>
                        <div class="adv_right">
                           <p class="adv_red">单个ID显示商品详情，多个ID显示商品列表</p>
                          
                      
                      <div class="form-group">
                        <label  class="col-md-2 control-label">商品ID<span class="required"></span></label>
                        <div class="col-md-6">
                          <input type="text" name="goods_id" id="goods_id"  value="" class="form-control"  placeholder="输入商品ID 多个ID请用英文 , 隔开">
                          </div>
                      </div>

                      <div class="form-group">
                        <label  class="col-md-2 control-label">零售价格</label>
                        <div class="col-md-6">
                          <input type="text" name="shop_price" id="_shop_price" value="<?php if($this->data['shop_price']){echo $this->data['shop_price'];}else{echo "0.00";}?>" maxlength="10" class="form-control">
                          <span class="help-block">例如：10.00</span> </div>
                      </div>   

                      <div class="form-group memberprice">
                        <label  class="col-md-2 control-label">市场价格</label>
                        <div class="col-md-6">
                          <input type="text" name="market_price" maxlength="10" class="form-control" value="<?php if($this->data['market_price']){echo $this->data['market_price'];}else{echo "0.00";}?>">
                          <span class="help-block">例如：10.00</span> </div>
                      </div> 

                      </div>
                    </div>

                    <div class="adv_edit">
                      <div class="adv_left">首页分类:</div>
                        <div class="adv_right">
                           <p class="adv_red">此处用于设置首页分类图标点击跳转的商品分类，所以需在广告位选择“<?=$this->c['position'][2]?>”时才有效。</p>
                          <div class="form-group">
                            <label  class="col-md-2 control-label">商品分类</label>
                            <div class="col-md-6">
                          <select name="caid" id="_caid" class="form-control">
                            <option value="">请选择分类</option>
                              <?php
                              if($this->cate){
                                  foreach($this->cate as $r){
                                      /* if($this->data['caid']==$r['caid']) $slk=' selected';
                                      else $slk = ''; */
                                      ?>
                                      <option value="<?=$r['caid'];?>">
                                          <?=$r['name'];?>
                                      </option>
                                      <?
                                      /*if($this->cate[$r['caid']]){
                                          foreach($this->cate[$r['caid']] as $s){
                                              if($this->data['caid']==$s['caid']) $slk=' selected';
                                              else $slk = '';
                                              */?><!--
                                          <option value="<?/*=$s['caid'];*/?>"<?/*=$slk;*/?>>
                                          &nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;<?/*=$s['name'];*/?>
                                          </option>-->
                                      <?
                                  }
                                  //}
                                  //}
                              }
                              ?>
                          </select>
                            </div>
                        </div>

                      </div>
                    </div>

                    </div>
                    <div class="form-actions fluid">
                      <div class="col-md-offset-3 col-md-9">
                        <button type="submit" class="btn green" id="ss">提交</button>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </form>
        <!-- END SAMPLE FORM PORTLET-->
      </div>
    </div>
    <!-- END PAGE CONTENT-->
  </div>
  <!-- END PAGE -->
</div>
<!-- END CONTAINER -->
<?php include $this->c['_homes']['_viewsHome'] . '/_global/_footer.php';?>
<!-- <script type="text/javascript" src="/style/assets/plugins/ckeditor/ckeditor.js"></script> -->
<script>
jQuery(document).ready(function() {    
   App.init();
});

function chkfrm(){
  if($("#title").prop("value")==""){
    swal("请输入广告名称");
    $("#title").focus();
    return false;
  }

  if($("#content").val()==""){
	 swal("请输入广告内容");
     $("#content").focus();
    return false;
  }
/*    if($("#_pic").val()==""){
		 swal("请上传图片");
	    return false;
	  }  */
/*   if($("#goods_id").val()==""){
		 swal("请输入商品ID");
		 $("#goods_id").focus();
	    return false;
	  } */
  if($("#sorts").val()==""){
    swal("请输入排序");
    $("#sorts").focus();
    return false;
  }


}


</script>
<script type="text/javascript">

    /**
     * 使用HTML5的FormData上传图片
     */
/*      function fileupload()
    {
 	   
         var data = document.getElementById('head_image');
         var fd =new FormData();
         fd.append('pic', data.files[0]);
    	
         $.ajax({
              url: "/adv/upload_img",
              type: "POST",
              data: fd,
              processData: false,  // 告诉jQuery不要去处理发送的数据
              contentType: false,   // 告诉jQuery不要去设置Content-Type请求头
              success: function(response,status,xhr){
            	  var response=eval("("+response+")");
            	
                 //$('#showimage_'+id).attr('src', response.path);
                 $('#_pic').val(response.pic_id);
                 $("#imgs").show();
                 $('#imgs').find('a').attr('href',response.path)
              }
         });
         return false;
    } */
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>